
#ifndef __XB_CORE_H__
#define __XB_CORE_H__

/* ------------------------------------------------------------------------- */

#include <portable.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>

#undef assert
#define assert(x)	if (!(x)) __asm int 3

/* ------------------------------------------------------------------------- */

#define bitsof(x)						(sizeof(x) << 3)
#define size_mask(size)					((uint32)(size_mask_table[(size) - 1]))
#define make_mask(offset, size)			(size_mask(size) << ((offset) << 3))
#define combine_data(org, data, mask)	(((org) & ~(mask)) | ((data) & (mask)))

/* ------------------------------------------------------------------------- */

capi uint32 size_mask_table[];

/* ------------------------------------------------------------------------- */

capi void power_on(void);
capi void power_off(void);

#ifndef NDEBUG
void write_log(const char *fmt, ...);
#endif

/* ------------------------------------------------------------------------- */

#endif
